package com.htjc.integral.conversion.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.htjc.integral.conversion.service.IAppMallAndElectroBindService;
import com.htjc.integral.conversion.service.impl.AppMallScoreCover;

import lombok.extern.slf4j.Slf4j;

/*
 * 自建网省积分流入
 * 
 * */
@Slf4j(topic = "conversionLogger")
@RestController
@RequestMapping(value = "/zjws/service")
public class ZJWSConversionIntegralController {
	@Autowired
	private AppMallScoreCover appMallScoreCover;
	
	@Autowired
	private IAppMallAndElectroBindService appMallAndElectroBindService;
	
	/**
	 * 积分转换接口
	 */
	@RequestMapping(value = "/scoreConvertByOne", method = { RequestMethod.POST, RequestMethod.GET })
	public void scoreConvertByOne(String token,String jsonpCallback,String jsonStr,HttpServletResponse response) throws Exception {
		log.info("===================进入积分转换接口===================");
		response.setContentType("text/html;charset=utf-8");
		
		String result = appMallScoreCover.scoreConvertByOne(token,jsonpCallback,jsonStr);
		response.getWriter().print(result);
		
		log.info("===================积分转换接口访问结束===================");
	}
	
	/**
	 * 获取绑信息定列表接口
	 */
	@RequestMapping(value = "/listBound", method = { RequestMethod.POST, RequestMethod.GET })
	public void listBound(String token,String jsonpCallback,String jsonStr,HttpServletResponse response) throws Exception {
		log.info("===================进入绑信息定列表接口===================");
		response.setContentType("text/html;charset=utf-8");
		
		String result = appMallAndElectroBindService.listBound(token,jsonpCallback,jsonStr);
		response.getWriter().print(result);
		
		log.info("===================绑信息定列表接口访问结束===================");
	}
	
	/**
	 * 获取用电户号对应的积分列表接口
	 */
	@RequestMapping(value = "/getConsNoIntegralDetail", method = { RequestMethod.POST, RequestMethod.GET })
	public void getConsNoIntegralDetail(String token,String jsonpCallback,String jsonStr,HttpServletResponse response) throws Exception {
		log.info("===================进入用电户号对应的积分列表接口===================");
		response.setContentType("text/html;charset=utf-8");
		
		String result = appMallAndElectroBindService.getConsNoIntegralDetail(token,jsonpCallback,jsonStr);
		response.getWriter().print(result);
		
		log.info("===================用电户号对应的积分列表接口访问结束===================");
	}
}
